<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>对象方法中绑定（实例1）</title>
</head>

<body>
    <h2>JavaScript <b>this</b> 关键字</h2>
    <p>在实例中，<b>this</b> 指向了 fullName 方法所属的对象 person。</p>
    <p id="demo"></p>
    <script>
        // 创建一个对象
        var person = {
            firstName: "John",
            lastName: " Doe",
            id: 5566,
            myFunction: function () {
                return this;
            }
        }

        // 显示表单数据
        document.getElementById("demo").innerHTML = person.myFunction();
    </script>
</body>

</html>